package com.grieous.domain;

import java.util.List;

public class PageModel {
	
	private Integer currentPage;
	private Integer pageSize;
	private Integer totalPage;
	private Integer totalRecord;
	@SuppressWarnings("rawtypes")
	private List list;

	public Integer getCurrentPage() {
		return currentPage;
	}

	public void setCurrentPage(Integer currentPage) {
		this.currentPage = currentPage;
	}

	public Integer getPageSize() {
		return pageSize;
	}

	public void setPageSize(Integer pageSize) {
		this.pageSize = pageSize;
	}

	public Integer getTotalPage() {
		return totalPage;
	}

	public void setTotalPage(Integer totalPage) {
		this.totalPage = totalPage;
	}

	public Integer getTotalRecord() {
		return totalRecord;
	}

	public void setTotalRecord(Integer totalRecord) {
		this.totalRecord = totalRecord;
	}

	@SuppressWarnings("rawtypes")
	public List getList() {
		return list;
	}

	@SuppressWarnings("rawtypes")
	public void setList(List list) {
		this.list = list;
	}

	public static <T> PageModel getPageModel(Integer pageSize, Integer page,
			int count, List<T> list) {
		PageModel pm = new PageModel();
		pm.setList(list);
		pm.setTotalRecord(count);
		pm.setPageSize(pageSize);
		pm.setCurrentPage(page);
		pm.setTotalPage((count + pageSize - 1) / pageSize);
		return pm;
	}
}
